# Maintainer: Guillaume ALAUX <guillaume@archlinux.org>

pkgname=hunspell-fr
pkgver=4.10
pkgrel=1
pkgdesc='French (modern) hunspell dictionaries'
arch=(any)
url='http://www.dicollecte.org/home.php?prj=fr'
license=('custom:MPLv2')
optdepends=('hunspell: the spell checking libraries and apps')
source=(http://www.dicollecte.org/download/fr/${pkgname/-fr/}-french-dictionaries-v${pkgver}.zip
        LICENSE)
sha256sums=('2c003b2ea58ca3433b54f15720c6e1f6fa4824f7e7728e8ebdeff563ef02d644'
            'fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85')

package() {
  cd "${srcdir}"
  install -dm755 ${pkgdir}/usr/share/hunspell
  install -m644 fr-moderne.dic ${pkgdir}/usr/share/hunspell/fr_FR.dic
  install -m644 fr-moderne.aff ${pkgdir}/usr/share/hunspell/fr_FR.aff

  pushd ${pkgdir}/usr/share/hunspell/
  fr_FR_aliases="fr_BE fr_CA fr_CH fr_LU"
  for lang in ${fr_FR_aliases}; do
	ln -s fr_FR.aff ${lang}.aff
	ln -s fr_FR.dic ${lang}.dic
  done

  popd

  # the symlinks
  install -dm755 ${pkgdir}/usr/share/myspell/dicts
  pushd ${pkgdir}/usr/share/myspell/dicts
    for file in ${pkgdir}/usr/share/hunspell/*; do
      ln -sv /usr/share/hunspell/$(basename ${file}) .
    done
  popd
  
  # docs
  install -Dm644 README_dict_fr.txt ${pkgdir}/usr/share/doc/${pkgname}/README_dict_fr.txt

  # license
  install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}
